import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import ElementUI  from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios';    
import "./assets/img/font/iconfont.css";//图标

import VueAxios from 'vue-axios'
import cookie from 'js-cookie'
import Messages from '@/Base/prompt.js'  
import echarts from 'echarts'  
import i18n from './i18n/i18n'
// import Vuei18n from "vue-i18n";//i18n
// Vue.use(Vuei18n)

Vue.config.productionTip = false;
Vue.use(ElementUI);
Vue.use(VueAxios, axios)
Vue.prototype.$information = Messages; //弹出框
 

// const i18n=new Vuei18n({
//   locale:'zh',
//   messages:{
//     'zh':require('./i18n/langs/zh'),
//     'en':require('./i18n/langs/en')
//   }
// })

Vue.prototype.$echarts = echarts
router.beforeEach((to, from, next) => {
    if (cookie.get('token')||to.path=="/login"){
      next()
    }else{
      next("/login")
    }
})
Vue.directive('Promise', {
  // 当被绑定的元素插入到 DOM 中时……
  inserted: function (el,sune) {
    console.log(el,sune.value)
        if(!cookie.get("perms").includes(sune.value)){
            el.remove()
        }
  }
})

window.app=new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount("#app");
